// xc_lshop/distr/shareholder/com/daterange.js
// var begin=new Date();
// var end =new Date(begin.setMonth((new Date().getMonth()-1)));

var myDate=new Date()
var year=myDate.getFullYear(); 
var month=myDate.getMonth() - 1; 
var date=myDate.getDate(); 
var nowdate=year+"-"+month+"-"+date;



Component({
  options: {
    addGlobalClass: true,
    multipleSlots: true
  },
  /**
   * 组件的属性列表
   */
  properties: {

  },

  /**
   * 组件的初始数据
   */
  data: {
    end:nowdate,
  
  },

  /**
   * 组件的方法列表
   */
  methods: {
    bindDateChange: function (e) {
      var val = e.currentTarget.dataset.val;
      console.log(val)
      if(val=='start'){
        this.setData({
          'startdate':e.detail.value
        })
      }else{
        this.setData({
          'enddate':e.detail.value
        })
      }
      
      var strwhere={ val, value: e.detail.value}
      var myEventDetail = strwhere // detail对象，提供给事件监听函数
      var myEventOption = {} // 触发事件的选项
      this.triggerEvent('datebtn', myEventDetail, myEventOption)
    },
  }
})